package com.ztman.router.common.view;

import android.view.View;
import android.widget.ImageView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.ztman.router.common.R;
import com.ztman.router.common.R2;
import com.ztman.router.common.base.BaseActivity;
import com.ztman.router.common.dagger.contract.TopContract;
import com.ztman.router.common.presenter.present_obj_.TopPresenter;

import butterknife.BindView;

/**
 * @Title:MainActivity
 * @Package:com.ztman.router.common.view
 * @Description:
 * @Auther:YJH
 * @Email:yuannunhua@gmail.com
 * @Date:2018/5/149:52
 */
public class TopActivity extends BaseActivity<TopPresenter> implements TopContract.Presenter {
    @BindView(R2.id.img_)
    ImageView img;

    @Override
    public void attachView(TopContract.View view) {

    }

    @Override
    public void detachView() {

    }

    @Override
    protected int setLayoutId() {
        return R.layout.activity_top;
    }

    @Override
    protected void initEventAll() {

        img.setImageResource(R.drawable.a56);
        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 1. 应用内简单的跳转(通过URL跳转在'进阶用法'中)
                ARouter.getInstance().build("/main/WechatActivity").navigation();

                // 2. 跳转并携带参数
//                ARouter.getInstance().build("/test/1")
//                        .withLong("key1", 666L)
//                        .withString("key3", "888")
//                        .withObject("key4", new Test("Jack", "Rose"))
//                        .navigation();
            }
        });
    }

    @Override
    protected void initInject() {
        getActivityComponent().inject(this);
    }

}
